/** @jsxRuntime automatic */
/** @jsxImportSource ../xml-runtime */
import { Format } from './Format'
import { Track } from './Track'

function Mono({ pathObject, mediaInfo, data, renderLinks }) {
  return (
    <audio>
      <Format.Audio mediaInfo={mediaInfo}></Format.Audio>
      <Track.Mono
        pathObject={pathObject}
        data={data}
        idPrefix="a-"
        renderLinks={renderLinks}
      ></Track.Mono>
    </audio>
  )
}

function Stereo({ pathObject, mediaInfo, data, renderLinks }) {
  return (
    <audio>
      <Format.Audio mediaInfo={mediaInfo}></Format.Audio>
      <numOutputChannels>2</numOutputChannels>
      <outputs>
        <group>
          <index>1</index>
          <numchannels>1</numchannels>
          <downmix>0</downmix>
          <channel>
            <index>1</index>
          </channel>
        </group>
        <group>
          <index>2</index>
          <numchannels>1</numchannels>
          <downmix>0</downmix>
          <channel>
            <index>2</index>
          </channel>
        </group>
      </outputs>
      <Track.Stereo
        data={data}
        pathObject={pathObject}
        idPrefix="al-" // audio-left
        explodedTrackIndex="0"
        trackIndex="1"
        trackCount="2"
        renderLinks={renderLinks}
      ></Track.Stereo>
      <Track.Stereo
        data={data}
        pathObject={pathObject}
        idPrefix="ar-" // audio-right
        explodedTrackIndex="1"
        trackIndex="2"
        trackCount="2"
        renderLinks={renderLinks}
      ></Track.Stereo>
    </audio>
  )
}

export const Audio = { Mono, Stereo }
